# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=pg_activity
pkgver=3.4.2
pkgrel=0
pkgdesc="Top like application for PostgreSQL server activity monitoring"
url="https://github.com/dalibo/pg_activity"
arch="noarch"
license="PostgreSQL"
depends="
	py3-attrs
	py3-blessed
	py3-humanize
	py3-psutil
	py3-psycopg2
	python3
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-psycopg
	py3-pytest
	"
provides="py3-pg_activity=$pkgver-r$pkgrel"
subpackages="$pkgname-pyc"
source="https://github.com/dalibo/pg_activity/archive/v$pkgver/pg_activity-$pkgver.tar.gz"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -p no:warnings \
		--ignore=tests/test_ui.txt \
		--ignore=tests/test_data.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
adcc12277341c60a8959103c30d38bdc76d2315130f1bb92239e5c2c8d20f8fc4a786be3fe1f97e3c142e6c74303a631017e1a3e6feaf18266b7fd42c2e155f3  pg_activity-3.4.2.tar.gz
"
